
//
//  MyCollectionCell.m
//  BusinessMarket
//
//  Created by Michael Li on 2018/10/31.
//  Copyright © 2018年 Michael Li. All rights reserved.
//

#import "MyCollectionCell.h"
#import "MyCollectionIconModel.h"
@interface MyCollectionCell()
@property (weak, nonatomic) IBOutlet UILabel *nameL;
@property (weak, nonatomic) IBOutlet UIImageView *iv;
@end
@implementation MyCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.contentView.backgroundColor = [UIColor whiteColor];
    UILongPressGestureRecognizer *longPre = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPre:)];
    [self.contentView addGestureRecognizer:longPre];
}
-(void)longPre:(UILongPressGestureRecognizer *)longPre
{
    XLog(@"longPre");
    if(longPre.state==UIGestureRecognizerStateChanged) {
        
        if ([self.delegate respondsToSelector:@selector(MyCollectionCell:withIndexPath:withLongPress:)]) {
            [self.delegate MyCollectionCell:self withIndexPath:self.indexPath withLongPress:longPre];
        }
    }
}
- (void)setIndexPath:(NSIndexPath *)indexPath
{
    _indexPath = indexPath;
    }
- (void)setIconMuta:(NSMutableArray *)iconMuta
{
    _iconMuta = iconMuta;
    XLog(@"iconMuta:%@",iconMuta);
//    if (iconMuta.count) {
        if (self.indexPath.section == 0) {
            self.layer.borderWidth  = 0;
            if (self.indexPath.row == 0) {
                MyCollectionIconModel *iconModel = iconMuta[0];
                self.nameL.text = @"我收藏的";
                [self.iv sd_setImageWithURL:[NSURL URLWithString:iconModel.icon] placeholderImage:[UIImage imageNamed:@"iconshoucang"]];
            }else if (self.indexPath.row == 1) {
                self.nameL.text = @"我联系的";
                MyCollectionIconModel *iconModel = iconMuta[1];
                [self.iv sd_setImageWithURL:[NSURL URLWithString:iconModel.icon] placeholderImage:[UIImage imageNamed:@"lianxijilu"]];
            }else {
                self.nameL.text = @"我发布的";
                MyCollectionIconModel *iconModel = iconMuta[2];
                [self.iv sd_setImageWithURL:[NSURL URLWithString:iconModel.icon] placeholderImage:[UIImage imageNamed:@"wofabude"]];
            }
        }else {
            self.layer.borderColor  = kBg.CGColor;
            self.layer.borderWidth  = 0.5;
            
            if (self.indexPath.row == 0) {
                self.nameL.text = @"消息中心";
                MyCollectionIconModel *iconModel = iconMuta[3];
                [self.iv sd_setImageWithURL:[NSURL URLWithString:iconModel.icon] placeholderImage:[UIImage imageNamed:@"xiaoxizhongxin"]];
            }else if (self.indexPath.row == 1) {
                self.nameL.text = @"实名认证";
                MyCollectionIconModel *iconModel = iconMuta[4];
                [self.iv sd_setImageWithURL:[NSURL URLWithString:iconModel.icon] placeholderImage:[UIImage imageNamed:@"shimingrenzheng"]];
            }else if (self.indexPath.row == 2) {
                self.nameL.text = @"我的店铺";
                MyCollectionIconModel *iconModel = iconMuta[5];
                [self.iv sd_setImageWithURL:[NSURL URLWithString:iconModel.icon] placeholderImage:[UIImage imageNamed:@"wodedianpu"]];
            }else if (self.indexPath.row == 3) {
                self.nameL.text = @"用户反馈";
                MyCollectionIconModel *iconModel = iconMuta[6];
                [self.iv sd_setImageWithURL:[NSURL URLWithString:iconModel.icon] placeholderImage:[UIImage imageNamed:@"yonghufankui"]];
            }else if (self.indexPath.row == 4) {
                self.nameL.text = @"关于我们";
                MyCollectionIconModel *iconModel = iconMuta[7];
                [self.iv sd_setImageWithURL:[NSURL URLWithString:iconModel.icon] placeholderImage:[UIImage imageNamed:@"guanyuwomen"]];
            }else {
                self.nameL.text = @"分享应用";
                MyCollectionIconModel *iconModel = iconMuta[8];
                [self.iv sd_setImageWithURL:[NSURL URLWithString:iconModel.icon] placeholderImage:[UIImage imageNamed:@"fenxiangyingyong"]];
            }
        }        
//    }

}
@end
